import static org.junit.Assert.*;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

/**
 * 
 */

/**
 * AIT 642 Project 4: VendingMachineItemTest
 * @author Madan Pun
 *
 */
public class VendingMachineItemTest {

	/**
	 * @throws java.lang.Exception
	 */
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	/**
	 * @throws java.lang.Exception
	 */
	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
	}

	/**
	 * Test method for {@link VendingMachineItem#VendingMachineItem(java.lang.String, double)}.
	 */
	@Test
	public void testVendingMachineItem() {
		VendingMachineItem item = new VendingMachineItem ("Coke Zero", 1.0);
		assertEquals ("Coke Zero", item.getName()); //Verify Item Name is correct
		assertEquals(1.0, item.getPrice(),0);  //Verify Item Price is correct
		
	}
	@Test(expected = VendingMachineException.class)
	public void testVendingMachineItem_InvalidPrice(){
		VendingMachineItem item = new VendingMachineItem ("Coke Zero", -1.0);
	}
	/**
	 * Test method for {@link VendingMachineItem#getName()}.
	 */
	@Test
	public void testGetName() {
		VendingMachineItem item = new VendingMachineItem("Coke Zero", 1.0);
		assertEquals("Coke Zero", item.getName());		
	}

	/**
	 * Test method for {@link VendingMachineItem#getPrice()}.
	 */
	@Test
	public void testGetPrice() {
		VendingMachineItem item = new VendingMachineItem("Coke Zero", 1.0);
		assertEquals(1.0, item.getPrice(), 0);		
		
	}

}
